const db = require('./config/db');

async function testConnection() {
  try {
    // 测试数据库连接
    const connection = await db.getConnection();
    console.log('数据库连接成功！');
    
    // 测试查询users表
    const [users] = await db.execute('SELECT * FROM users LIMIT 5');
    console.log('Users表数据:');
    console.log(users);
    
    // 测试查询information表
    const [containers] = await db.execute('SELECT * FROM information LIMIT 5');
    console.log('Information表数据:');
    console.log(containers);
    
    // 关闭连接
    connection.release();
    console.log('测试完成');
  } catch (err) {
    console.error('数据库连接失败:', err.message);
  }
}

testConnection();